package leetcode.code1936;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int addRungs(int[] rungs, int dist) {
		int ans = this.addRungs(rungs[0], 0, dist);
		for (int i = 1; i < rungs.length; i++) {
			if (rungs[i] - rungs[i - 1] > dist) {
				ans += this.addRungs(rungs[i], rungs[i - 1], dist);
			}
		}
		return ans;
	}

	private int addRungs(int to, int from, int dist) {
		return (to - from + dist - 1) / dist - 1;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
